<?php

namespace App\Model;


use Illuminate\Support\Facades\DB;

class RoomRecommendLabel extends BaseModel
{
    protected $table = 'room_recommend_label';
    protected $table_room_label = 'room_label';

    public function getList(){

        $query = new self();

        return $query->orderBy('id','desc')->get();
    }

    //删除房间标签
    public function delRoomLabel($id)
    {
        return curl_request(getKkaudioApiUrl() . '/inner/room/label/del', ['id' => $id], 'json', 'POST');
    }

    public function getRoomLabelById($room_id){
        return DB::connection('api')->table($this->table_room_label)->where('room_id' ,$room_id)->first();
    }

    public function insertOrUpdateLabel($data){
        return curl_request(getKkaudioApiUrl() . '/inner/room/label/insertOrUpdate', $data, 'json', 'POST');
    }

    public function delNotRecommendLabel($id){
        return curl_request(getKkaudioApiUrl() . '/inner/room/label/delRoomLabel', ['room_id' => $id], 'json', 'POST');
    }
}
